Skip to main content

average

Type

function

Summary

Returns the arithmetic mean of a list of numbers.

Syntax

average(<numbersList>)

Description

Use the average function to find the value that best represents a group of values.

The average of a list of numbers is the sum of the items in the list or elements in the array, divided by the number of items or elements.

The average function can also be written like this:

    sum(numbersList)/the number of items in numbersList

If the numbersList is empty, the average function returns zero.

If a math operation on finite inputs produces a non-finite output, an execution error is thrown. See math operations for more information.

Parameters

NameTypeDescription

numbersList

A comma-separated list of numbers, or an expression that evaluates to such a list, or an array containing only numbers.

Examples

average(4,36,45,50,75) -- returns 42
put average(importedList) into field "Arithmetic Mean"
put average(replaceText(field "Values",return,comma)) into avgValue

function: min, geometricMean, statRound, harmonicMean, variance, round, value, max, median, standardDeviation

glossary: return, value, math operation

control structure: function

Compatibility and Support

Introduced

LiveCode 1.0

OS

mac

windows

linux

ios

android

Platforms

desktop

server

mobile

Thank you for your feedback!

Was this page helpful?